package org.openmore.platform.wechatMini;

import cn.binarywang.wx.miniapp.api.WxMaService;
import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult;
import cn.binarywang.wx.miniapp.bean.WxMaPhoneNumberInfo;
import cn.binarywang.wx.miniapp.bean.WxMaUserInfo;
import cn.binarywang.wx.miniapp.message.WxMaMessageRouter;
import me.chanjar.weixin.common.bean.result.WxMediaUploadResult;

import java.io.File;

public interface WechatMiniAppService {

    WxMaService getMaService(String tenantId);

    WxMaMessageRouter getMaRouter(String tenantId);

    /**登陆接口*/
    WxMaJscode2SessionResult login(String tenantId, String code);

    /**获取用户信息接口*/
    WxMaUserInfo info(String tenantId, String sessionKey,
                      String signature, String rawData, String encryptedData, String iv);
    /**获取用户绑定手机号信息接口*/
    WxMaPhoneNumberInfo phone(String tenantId, String sessionKey, String signature,
                              String rawData, String encryptedData, String iv);

    /**接收到来自微信服务器的认证消息*/
    String checkSignature(String tenantId, String timestamp, String nonce, String signature, String echostr);

    /**处理接收微信请求*/
    String handleMessage(String tenantId, String requestBody, String msgSignature, String encryptType,
                         String signature, String timestamp, String nonce);

    /**上传临时素材*/
    WxMediaUploadResult uploadMedia(String tenantId, File file);

    /**下载临时素材*/
    File getMedia(String tenantId, String mediaId);
}
